//
//  DefineGame.h
//  ProjectL
//
//  Created by Nguyen Tan Loc on 8/16/13.
//  Copyright (c) 2013 Nguyen Tan Loc. All rights reserved.
//

#ifndef ProjectL_DefineGame_h
#define ProjectL_DefineGame_h

// macro
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define uniPos(__iPhone__, __iPad__) (IS_IPHONE ? __iPhone__ : __iPad__)

extern float OFFSET_X_UI;
extern float OFFSET_Y_UI;
extern float SCALE_SPRITE;
#define unicpp(x, y) IS_IPHONE ? ccp(x + OFFSET_X_UI, y + OFFSET_Y_UI) : ccp(x * 2 + OFFSET_X_UI, y * 2 + OFFSET_Y_UI)

#define APPSTORE_ID 827139182

typedef enum
{
    eO_USER_NODE    = 0x0001,
    eO_PATH_NODE    = 0x0002,
    eO_LAZER_LINE   = 0x0003,
    eO_BOMB         = 0x0004,
    eO_ENERGY       = 0x0005,
    eO_CACTUS_SPIKE = 0x0006,
    eO_ITEM         = 0x0006,
    eO_BOUNDARY     = 0x0007,
    eO_EXPLOSION    = 0x0008,
    eO_BOUNC_BALL   = 0x0009,
    eO_MAGNET       = 0x0010,
    eO_BOMB_RANGE   = 0x0011,
} OBJECT_TYPE;

typedef enum
{
    eGT_BOMB = 0,
    eGT_LAZER,
    eGT_RELEASE_TOUCH,
    eGT_CACTUS,
    eGT_OUT_OF_TIME,
    eGT_BOUNC_BALL,
    eGT_SPREAD_LINE,
    eGT_NODE_OUT_OF_SCREEN,
    eGT_WIN,
} ENDGAME_TYPE;

typedef enum
{
    eIT_SHIELD = 0,
    eIT_XRAY,
    eIT_TIMER,
    eIT_MAGNET,
} ITEM_TYPE;

typedef enum
{
    eIAP_TINY = 0,
    eIAP_SMALL,
    eIAP_MEDIUM,
    eIAP_LARGE,
} IAP_TYPE;


// Define collide
#define MASK_BIT_USER_NODE      eO_PATH_NODE | eO_BOMB | eO_LAZER_LINE | eO_ENERGY | eO_CACTUS_SPIKE | eO_EXPLOSION | eO_ITEM
#define MASK_BIT_PATH_NODE      eO_USER_NODE
#define MASK_BIT_LAZER_LINE     eO_USER_NODE
#define MASK_BIT_BOMB           eO_BOMB | eO_USER_NODE
#define MASK_BIT_BOMB_RANGE     eO_USER_NODE
#define MASK_BIT_ENERGY         eO_USER_NODE | eO_MAGNET
#define MASK_BIT_CACTUS_SPIKE   eO_USER_NODE
#define MASK_BIT_ITEM           eO_USER_NODE
#define MASK_BIT_BOUNDARY       eO_BOUNC_BALL
#define MASK_BIT_EXPLOSION      eO_USER_NODE
#define MASK_BIT_BOUNC_BALL     eO_USER_NODE | eO_BOUNDARY
#define MASK_BIT_MAGNET_ZONE    eO_ENERGY

// Global batch level
#define Z_ORDER_BOUNC_BALL_E    52
#define Z_ORDER_BOUNC_BALL_G    51
#define Z_ORDER_BOUNC_BALL      50


#define Z_ORDER_VIRUS           37
#define Z_ORDER_USER_NODE       36

#define Z_ORDER_ENERGY          35
#define Z_ORDER_LAZER_NODE      34
#define Z_ORDER_LAZER_LINE      33
#define Z_ORDER_SMALL_LIGHT     28

#define Z_ORDER_PATH_NODE       26
#define Z_ORDER_LINE            25
#define Z_ORDER_SHIELD_ELEMENT  24
#define Z_ORDER_SHIELD_ZONE     23


#define Z_ORDER_MAGNET_ZONE     0
#define Z_ORDER_BOMB_INDICATOR  19
#define Z_ORDER_BOMB            18
#define Z_ORDER_CACTUS_SPIKE    17
#define Z_ORDER_ITEM            16

// main game level
#define Z_ORDER_PATH            0
#define Z_ORDER_LAZER           15
#define Z_ORDER_BATCH           5 // must higher than path
#define Z_ORDER_DARK_FOG        20
#define Z_ORDER_TUTORIAL        30

#define PATH_LINE_ALPHA_IDLE            0.5
#define PATH_LINE_ALPHA_CONNECTED       1.0
#define PATH_LINE_SPREAD_ALPHA_RANGE    uniPos(20, 40)

#define ACTION_TYPE_ROTATE      1
#define ACTION_TYPE_MOVE_TO     2
#define ACTION_TYPE_ROTATE_A    3

#define DARK_FOG_ZOOM_IN        2.5
#define DARK_FOG_ZOOM_OUT       18
#define DARK_FOG_ZOOM_SPEED     10

extern BOOL     IS_SUPPORT_RETINA;
extern float    PATH_NODE_SPREAD_TIME;
extern float    PATH_LINE_SPREAD_SPEED;

// define for layer order & touch priority
#define Z_MAIN_GAME         0
#define Z_MAIN_UI           1
#define Z_RESULT_POPUP      2
#define Z_CALIBRATE_POPUP   3

#define TOUCH_PRIORITY_MAIN_GAME        2
#define TOUCH_PRIORITY_MAIN_UI          1
#define TOUCH_PRIORITY_RESULT_POPUP     0

#define POPUP_ALPHA         200
#define POPUP_ANIMATE_TIME  0.5

#define ITEM_TIMER_PLUS         10
#define ITEM_TIMER_PLUS_SPEED   20
#define ITEM_SHIELD_INFINITY    -1
#define ITEM_MAX_SHIELD         1
#define ITEM_MAX_TIMER          3
#define ITEM_MAX_MAGNET         1
#define ITEM_MAX_XRAY           1

#define TAG_SHIELD_ZONE         20005

// define for key
#define KEY_SETTING_SOUND_FX    @"key_sound_fx"
#define KEY_SETTING_SOUND_BG    @"key_sound_bg"
#define KEY_LEVEL_DETAIL_SCORE  @"key_level_score"
#define KEY_LEVEL_DETAIL_STAR   @"key_level_star"
#define KEY_LEVEL_DETAIL_ENERGY @"key_level_energy"
#define KEY_LEVEL_DETAIL_TIME   @"key_level_time"
#define KEY_LEVEL_MAX_REACH     @"key_level_max_reach"

#define KEY_USER_INFO           @"key_user_info"
#define KEY_PAYMENT_GOLD        @"key_payment_gold"
#define KEY_ITEM_NUM_GLOVE      @"key_item_num_glove"
#define KEY_ITEM_NUM_XRAY       @"key_item_num_xray"
#define KEY_ITEM_NUM_TIME       @"key_item_num_time"
#define KEY_ITEM_NUM_MAGNET     @"key_item_num_magnet"
#define KEY_FIRST_TIME_PLAY     @"key_first_time_play"
#define KEY_FIRST_TIME_SHIELD   @"key_first_time_shield"
#define KEY_FIRST_TIME_TIME     @"key_first_time_time"
#define KEY_FIRST_TIME_MAGNET   @"key_first_time_magnet"
#define KEY_FIRST_TIME_XRAY     @"key_first_time_xray"
#define KEY_FIRST_TIME_OPEN     @"key_first_time_open"
#define KEY_SHARE_10            @"key_share_10"
#define KEY_SHARE_20            @"key_share_20"
#define KEY_SHARE_30            @"key_share_30"
#define KEY_SHARE_40            @"key_share_40"



#define GOLD_PER_STAR       10
#define BBOMB_EXPLODE_TIME  1
#define SPEED_NODE          uniPos(250, 500)

#define EVENT_CALIBRATE_POPUP_CLOSE @"CalibratePopupClose"
#define EVENT_REQUIRE_POPUP_CLOSE   @"RequirePopupClose"
#define EVENT_ON_COUNT_DONE         @"OnCountDone"
#define EVENT_GOLD_CHANGED          @"OnGoldChanged"
#define EVENT_BOMB_EXPLOSION        @"OnBombExplosion"
#define EVENT_ITEM_CHANGED          @"OnItemChanged"

// define price
#define PRICE_ITEM_SHIELD   600
#define PRICE_ITEM_MAGNET   400
#define PRICE_ITEM_XRAY     400
#define PRICE_ITEM_TIMER    300

#define PRICE_GOLD_TINY     0.99
#define PRICE_GOLD_SMALL    1.99
#define PRICE_GOLD_MEDIUM   3.99
#define PRICE_GOLD_LARGE    7.99

#define IDENTIFIER_GOLD_PACKET_TINY     @"com.pixeption.1path.iap.tinygoldpacket"
#define IDENTIFIER_GOLD_PACKET_SMALL    @"com.pixeption.1path.iap.smallgoldpacket"
#define IDENTIFIER_GOLD_PACKET_MEDIUM   @"com.pixeption.1path.iap.mediumgoldpacket"
#define IDENTIFIER_GOLD_PACKET_LARGE    @"com.pixeption.1path.iap.largegoldpacket"

#define NUM_GOLD_PACKET_TINY    2000
#define NUM_GOLD_PACKET_SMALL   4500
#define NUM_GOLD_PACKET_MEDIUM  10000
#define NUM_GOLD_PACKET_LARGE   22000
#define GOLD_CHANGE_SPEED       400

#endif
